import { Role } from "@/api";

// 加载路由权限
const load_route_limit = async (context, payload) => {
    let { status, msg, data } = await Role.route(payload);
    if (status) {
        context.commit('LOAD_ROUTE_LIMIT', data);
    }
    return { status, msg, data }
}
// 修改路由权限
const edit_route_limit = async (context, payload) => {
    console.log(payload);
    let { status, msg } = await Role.edit_route(payload)
    if (status) {
        // context.commit('UPDATE_ROUTE_LIMIT', payload);
    }
    return { status, msg }
}
// 加载菜单权限
const load_menu_limit = async (context, payload) => {
    let { status, msg, data } = await Role.get_menu(payload);
    if (status) {
        context.commit('LOAD_MENU_LIMIT', data);
    }
    return { status, msg, data }
}
// 修改菜单权限
const edit_menu_limit = async (context, payload) => {
    let { status, msg } = await Role.menu(payload)
    console.log(msg);
    if (status) {
        // context.commit('UPDATE_MENU_LIMIT', payload);
    }
    return { status, msg }
}


export default {
    load_route_limit,
    edit_route_limit,
    load_menu_limit,
    edit_menu_limit,
}